package function;

import java.lang.reflect.Field;

/**
 * @ClassName: BeanConfig
 * @Author: 王延
 * @Date: 2019/7/24 16:19
 * @Description :
 */
public class BeanConfig {
    public static void main(String[] args) {
        Ads ads = new Ads();
        ads.setId("a01");
        //ads.setCreateTime("jk");
        wapperBean(ads);
        System.out.println(ads);
    }

    public static <T> void wapperBean(T t) {
        try {
            Field createTime = t.getClass().getDeclaredField("createTime");
            createTime.setAccessible(true);
            if (createTime.get(t) == null) {
                createTime.set(t, "98");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
